home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 January: Mac OS SDK / Dev.CD Jan 00 SDK1.toast / Development Kits / Mac OS / QuickTime / QuickTime 3 Interfaces & Libs / QTDevWin / CIncludes / Lists.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  12.4 KB  |  430 lines  |  [TEXT/dosa]

  1. /*
  2.      File:        Lists.h
  3.  
  4.      Contains:    List Manager Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1985-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __LISTS__
  19. #define __LISTS__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24. #ifndef __CONTROLS__
  25. #include <Controls.h>
  26. #endif
  27.  
  28.  
  29.  
  30. #if PRAGMA_ONCE
  31. #pragma once
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_STRUCT_ALIGN
  43.     #pragma options align=mac68k
  44. #elif PRAGMA_STRUCT_PACKPUSH
  45.     #pragma pack(push, 2)
  46. #elif PRAGMA_STRUCT_PACK
  47.     #pragma pack(2)
  48. #endif
  49.  
  50. typedef Point                             Cell;
  51. typedef Rect                             ListBounds;
  52. typedef char                             DataArray[32001];
  53. typedef char *                            DataPtr;
  54. typedef DataPtr *                        DataHandle;
  55. typedef CALLBACK_API( short , ListSearchProcPtr )(Ptr aPtr, Ptr bPtr, short aLen, short bLen);
  56. typedef CALLBACK_API( Boolean , ListClickLoopProcPtr )(void );
  57. /*
  58.     WARNING: ListClickLoopProcPtr uses register based parameters under classic 68k
  59.              and cannot be written in a high-level language without 
  60.              the help of mixed mode or assembly glue.
  61. */
  62. typedef STACK_UPP_TYPE(ListSearchProcPtr)                         ListSearchUPP;
  63. typedef REGISTER_UPP_TYPE(ListClickLoopProcPtr)                 ListClickLoopUPP;
  64. #if !TARGET_OS_MAC
  65. /* QuickTime 3.0 */
  66. typedef long                             ListNotification;
  67.  
  68. enum {
  69.     listNotifyNothing            = FOUR_CHAR_CODE('nada'),        /* No (null) notification*/
  70.     listNotifyClick                = FOUR_CHAR_CODE('clik'),        /* Control was clicked*/
  71.     listNotifyDoubleClick        = FOUR_CHAR_CODE('dblc'),        /* Control was double-clicked*/
  72.     listNotifyPreClick            = FOUR_CHAR_CODE('pclk')        /* Control about to be clicked*/
  73. };
  74.  
  75. #endif  /*  !TARGET_OS_MAC */
  76.  
  77.  
  78. struct ListRec {
  79.     Rect                             rView;
  80.     GrafPtr                         port;
  81.     Point                             indent;
  82.     Point                             cellSize;
  83.     ListBounds                         visible;
  84.     ControlHandle                     vScroll;
  85.     ControlHandle                     hScroll;
  86.     SInt8                             selFlags;
  87.     Boolean                         lActive;
  88.     SInt8                             lReserved;
  89.     SInt8                             listFlags;
  90.     long                             clikTime;
  91.     Point                             clikLoc;
  92.     Point                             mouseLoc;
  93.     ListClickLoopUPP                 lClickLoop;
  94.     Cell                             lastClick;
  95.     long                             refCon;
  96.     Handle                             listDefProc;
  97.     Handle                             userHandle;
  98.     ListBounds                         dataBounds;
  99.     DataHandle                         cells;
  100.     short                             maxIndex;
  101.     short                             cellArray[1];
  102. };
  103. typedef struct ListRec                    ListRec;
  104.  
  105. typedef ListRec *                        ListPtr;
  106. typedef ListPtr *                        ListHandle;
  107. /* ListRef is obsolete.  Use ListHandle. */
  108. typedef ListHandle                         ListRef;
  109.  
  110.  
  111.  
  112. enum {
  113.                                                                 /* ListRec.listFlags bits*/
  114.     lDoVAutoscrollBit            = 1,
  115.     lDoHAutoscrollBit            = 0
  116. };
  117.  
  118.  
  119. enum {
  120.                                                                 /* ListRec.listFlags masks*/
  121.     lDoVAutoscroll                = 2,
  122.     lDoHAutoscroll                = 1
  123. };
  124.  
  125.  
  126.  
  127. enum {
  128.                                                                 /* ListRec.selFlags bits*/
  129.     lOnlyOneBit                    = 7,
  130.     lExtendDragBit                = 6,
  131.     lNoDisjointBit                = 5,
  132.     lNoExtendBit                = 4,
  133.     lNoRectBit                    = 3,
  134.     lUseSenseBit                = 2,
  135.     lNoNilHiliteBit                = 1
  136. };
  137.  
  138.  
  139.  
  140. enum {
  141.                                                                 /* ListRec.selFlags masks*/
  142.     lOnlyOne                    = -128,
  143.     lExtendDrag                    = 64,
  144.     lNoDisjoint                    = 32,
  145.     lNoExtend                    = 16,
  146.     lNoRect                        = 8,
  147.     lUseSense                    = 4,
  148.     lNoNilHilite                = 2
  149. };
  150.  
  151.  
  152.  
  153. enum {
  154.                                                                 /* LDEF messages*/
  155.     lInitMsg                    = 0,
  156.     lDrawMsg                    = 1,
  157.     lHiliteMsg                    = 2,
  158.     lCloseMsg                    = 3
  159. };
  160.  
  161.  
  162.  
  163.  
  164. typedef CALLBACK_API( void , ListDefProcPtr )(short lMessage, Boolean lSelect, Rect *lRect, Cell lCell, short lDataOffset, short lDataLen, ListHandle lHandle);
  165. typedef STACK_UPP_TYPE(ListDefProcPtr)                             ListDefUPP;
  166. enum { uppListSearchProcInfo = 0x00002BE0 };                     /* pascal 2_bytes Func(4_bytes, 4_bytes, 2_bytes, 2_bytes) */
  167. enum { uppListClickLoopProcInfo = 0x00000012 };                 /* register 1_byte:D0 Func() */
  168. enum { uppListDefProcInfo = 0x000EBD80 };                         /* pascal no_return_value Func(2_bytes, 1_byte, 4_bytes, 4_bytes, 2_bytes, 2_bytes, 4_bytes) */
  169. #define NewListSearchProc(userRoutine)                             (ListSearchUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppListSearchProcInfo, GetCurrentArchitecture())
  170. #define NewListClickLoopProc(userRoutine)                         (ListClickLoopUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppListClickLoopProcInfo, GetCurrentArchitecture())
  171. #define NewListDefProc(userRoutine)                             (ListDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppListDefProcInfo, GetCurrentArchitecture())
  172. #define CallListSearchProc(userRoutine, aPtr, bPtr, aLen, bLen)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppListSearchProcInfo, (aPtr), (bPtr), (aLen), (bLen))
  173. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  174.     #pragma parameter __D0 CallListClickLoopProc(__A0)
  175.     Boolean CallListClickLoopProc(ListClickLoopUPP routine) = 0x4E90;
  176. #else
  177.     #define CallListClickLoopProc(userRoutine)                     CALL_ZERO_PARAMETER_UPP((userRoutine), uppListClickLoopProcInfo)
  178. #endif
  179. #define CallListDefProc(userRoutine, lMessage, lSelect, lRect, lCell, lDataOffset, lDataLen, lHandle)  CALL_SEVEN_PARAMETER_UPP((userRoutine), uppListDefProcInfo, (lMessage), (lSelect), (lRect), (lCell), (lDataOffset), (lDataLen), (lHandle))
  180.  
  181.  
  182. #if !TARGET_OS_MAC
  183. /* QuickTime 3.0 */
  184. typedef CALLBACK_API( void , ListNotificationProcPtr )(ListHandle theList, ListNotification notification, long param);
  185. EXTERN_API_C( void )
  186. LSetNotificationCallback        (ListNotificationProcPtr  callBack,
  187.                                  ListHandle             lHandle);
  188.  
  189. #endif  /*  !TARGET_OS_MAC */
  190.  
  191.  
  192.  
  193. EXTERN_API( ListHandle )
  194. LNew                            (const Rect *            rView,
  195.                                  const ListBounds *        dataBounds,
  196.                                  Point                     cSize,
  197.                                  short                     theProc,
  198.                                  WindowPtr                 theWindow,
  199.                                  Boolean                 drawIt,
  200.                                  Boolean                 hasGrow,
  201.                                  Boolean                 scrollHoriz,
  202.                                  Boolean                 scrollVert)                            THREEWORDINLINE(0x3F3C, 0x0044, 0xA9E7);
  203.  
  204. EXTERN_API( void )
  205. LDispose                        (ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0028, 0xA9E7);
  206.  
  207. EXTERN_API( short )
  208. LAddColumn                        (short                     count,
  209.                                  short                     colNum,
  210.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0004, 0xA9E7);
  211.  
  212. EXTERN_API( short )
  213. LAddRow                            (short                     count,
  214.                                  short                     rowNum,
  215.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0008, 0xA9E7);
  216.  
  217. EXTERN_API( void )
  218. LDelColumn                        (short                     count,
  219.                                  short                     colNum,
  220.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0020, 0xA9E7);
  221.  
  222. EXTERN_API( void )
  223. LDelRow                            (short                     count,
  224.                                  short                     rowNum,
  225.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0024, 0xA9E7);
  226.  
  227. EXTERN_API( Boolean )
  228. LGetSelect                        (Boolean                 next,
  229.                                  Cell *                    theCell,
  230.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x003C, 0xA9E7);
  231.  
  232. EXTERN_API( Cell )
  233. LLastClick                        (ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0040, 0xA9E7);
  234.  
  235. EXTERN_API( Boolean )
  236. LNextCell                        (Boolean                 hNext,
  237.                                  Boolean                 vNext,
  238.                                  Cell *                    theCell,
  239.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0048, 0xA9E7);
  240.  
  241. EXTERN_API( Boolean )
  242. LSearch                            (const void *            dataPtr,
  243.                                  short                     dataLen,
  244.                                  ListSearchUPP             searchProc,
  245.                                  Cell *                    theCell,
  246.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0054, 0xA9E7);
  247.  
  248. EXTERN_API( void )
  249. LSize                            (short                     listWidth,
  250.                                  short                     listHeight,
  251.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0060, 0xA9E7);
  252.  
  253. EXTERN_API( void )
  254. LSetDrawingMode                    (Boolean                 drawIt,
  255.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x002C, 0xA9E7);
  256.  
  257. EXTERN_API( void )
  258. LScroll                            (short                     dCols,
  259.                                  short                     dRows,
  260.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0050, 0xA9E7);
  261.  
  262. EXTERN_API( void )
  263. LAutoScroll                        (ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0010, 0xA9E7);
  264.  
  265. EXTERN_API( void )
  266. LUpdate                            (RgnHandle                 theRgn,
  267.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0064, 0xA9E7);
  268.  
  269. EXTERN_API( void )
  270. LActivate                        (Boolean                 act,
  271.                                  ListHandle             lHandle)                            TWOWORDINLINE(0x4267, 0xA9E7);
  272.  
  273. EXTERN_API( void )
  274. LCellSize                        (Point                     cSize,
  275.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0014, 0xA9E7);
  276.  
  277. EXTERN_API( Boolean )
  278. LClick                            (Point                     pt,
  279.                                  short                     modifiers,
  280.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0018, 0xA9E7);
  281.  
  282. EXTERN_API( void )
  283. LAddToCell                        (const void *            dataPtr,
  284.                                  short                     dataLen,
  285.                                  Cell                     theCell,
  286.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x000C, 0xA9E7);
  287.  
  288. EXTERN_API( void )
  289. LClrCell                        (Cell                     theCell,
  290.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x001C, 0xA9E7);
  291.  
  292. EXTERN_API( void )
  293. LGetCell                        (void *                    dataPtr,
  294.                                  short *                dataLen,
  295.                                  Cell                     theCell,
  296.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0038, 0xA9E7);
  297.  
  298. EXTERN_API( void )
  299. LRect                            (Rect *                    cellRect,
  300.                                  Cell                     theCell,
  301.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x004C, 0xA9E7);
  302.  
  303. EXTERN_API( void )
  304. LSetCell                        (const void *            dataPtr,
  305.                                  short                     dataLen,
  306.                                  Cell                     theCell,
  307.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0058, 0xA9E7);
  308.  
  309. EXTERN_API( void )
  310. LSetSelect                        (Boolean                 setIt,
  311.                                  Cell                     theCell,
  312.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x005C, 0xA9E7);
  313.  
  314. EXTERN_API( void )
  315. LDraw                            (Cell                     theCell,
  316.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0030, 0xA9E7);
  317.  
  318.  
  319. EXTERN_API( void )
  320. LGetCellDataLocation            (short *                offset,
  321.                                  short *                len,
  322.                                  Cell                     theCell,
  323.                                  ListHandle             lHandle)                            THREEWORDINLINE(0x3F3C, 0x0034, 0xA9E7);
  324.  
  325. #if !TARGET_OS_MAC
  326. /* QuickTime 3.0 */
  327. EXTERN_API_C( void )
  328. LSetLDEF                        (ListDefProcPtr         proc,
  329.                                  ListRef                 lHandle);
  330.  
  331. #endif  /*  !TARGET_OS_MAC */
  332.  
  333.  
  334. #if CGLUESUPPORTED
  335. EXTERN_API_C( void )
  336. laddtocell                        (const void *            dataPtr,
  337.                                  short                     dataLen,
  338.                                  const Cell *            theCell,
  339.                                  ListHandle             lHandle);
  340.  
  341. EXTERN_API_C( void )
  342. lclrcell                        (const Cell *            theCell,
  343.                                  ListHandle             lHandle);
  344.  
  345. EXTERN_API_C( void )
  346. lgetcelldatalocation            (short *                offset,
  347.                                  short *                len,
  348.                                  const Cell *            theCell,
  349.                                  ListHandle             lHandle);
  350.  
  351. EXTERN_API_C( void )
  352. lgetcell                        (void *                    dataPtr,
  353.                                  short *                dataLen,
  354.                                  const Cell *            theCell,
  355.                                  ListHandle             lHandle);
  356.  
  357. EXTERN_API_C( ListHandle )
  358. lnew                            (const Rect *            rView,
  359.                                  const ListBounds *        dataBounds,
  360.                                  Point *                cSize,
  361.                                  short                     theProc,
  362.                                  WindowPtr                 theWindow,
  363.                                  Boolean                 drawIt,
  364.                                  Boolean                 hasGrow,
  365.                                  Boolean                 scrollHoriz,
  366.                                  Boolean                 scrollVert);
  367.  
  368. EXTERN_API_C( void )
  369. lrect                            (Rect *                    cellRect,
  370.                                  const Cell *            theCell,
  371.                                  ListHandle             lHandle);
  372.  
  373. EXTERN_API_C( void )
  374. lsetcell                        (const void *            dataPtr,
  375.                                  short                     dataLen,
  376.                                  const Cell *            theCell,
  377.                                  ListHandle             lHandle);
  378.  
  379. EXTERN_API_C( void )
  380. lsetselect                        (Boolean                 setIt,
  381.                                  const Cell *            theCell,
  382.                                  ListHandle             lHandle);
  383.  
  384. EXTERN_API_C( void )
  385. ldraw                            (const Cell *            theCell,
  386.                                  ListHandle             lHandle);
  387.  
  388. EXTERN_API_C( Boolean )
  389. lclick                            (Point *                pt,
  390.                                  short                     modifiers,
  391.                                  ListHandle             lHandle);
  392.  
  393. EXTERN_API_C( void )
  394. lcellsize                        (Point *                cSize,
  395.                                  ListHandle             lHandle);
  396.  
  397. #endif  /* CGLUESUPPORTED */
  398.  
  399. #if OLDROUTINENAMES
  400. #define LDoDraw(drawIt, lHandle) LSetDrawingMode(drawIt, lHandle)
  401. #define LFind(offset, len, theCell, lHandle) LGetCellDataLocation(offset, len, theCell, lHandle)
  402. #if CGLUESUPPORTED
  403. #define lfind(offset, len, theCell, lHandle) lgetcelldatalocation(offset, len, theCell, lHandle)
  404. #endif  /* CGLUESUPPORTED */
  405.  
  406. #endif  /* OLDROUTINENAMES */
  407.  
  408.  
  409.  
  410. #if PRAGMA_STRUCT_ALIGN
  411.     #pragma options align=reset
  412. #elif PRAGMA_STRUCT_PACKPUSH
  413.     #pragma pack(pop)
  414. #elif PRAGMA_STRUCT_PACK
  415.     #pragma pack()
  416. #endif
  417.  
  418. #ifdef PRAGMA_IMPORT_OFF
  419. #pragma import off
  420. #elif PRAGMA_IMPORT
  421. #pragma import reset
  422. #endif
  423.  
  424. #ifdef __cplusplus
  425. }
  426. #endif
  427.  
  428. #endif /* __LISTS__ */
  429.  
  430.